< previous page page_84 next page >

Page 84
So all you need to do now is create a VB declaration for the RASDIALARAMS structure. It is defined in the C header file as follows:
typedef struct _RASDIALPARAMS {
   DWORD  dwSize;
   TCHAR  szEntryName[RAS_MaxEntryName + 1];
   TCHAR  szPhoneNumber[RAS_MaxPhoneNumber + 1];
   TCHAR  szCallbackNumber[RAS_MaxCallbackNumber + 1];
   TCHAR  szUserName[UNLEN + 1];
   TCHAR  szPassword[PWLEN + 1];
   TCHAR  szDomain[DNLEN + 1] ;
#if (WINVER >= 0x401)
   DWORD  dwSubEntry;
   DWORD  dwCallbackId;
#endif
} RASDIALPARAMS;
The dwSize field has to be loaded with the size of the structure before the RasGetEntryDialParams function is called.
The RasTest program from Puzzle 18 has been modified to call the RasGetEntryDialParams function for a phone book entry that appears in the application's lstEntries list box:
Private Sub lstEntries_Click()
   Dim rs As RASDIALPARAMS
   Dim res As Long
   Dim Password As Long
   rs.szEntryName = lstEntries.Text
   rs.dwSize = Len(rs)
   lstDetails. Clear
   res = RasGetEntryDialParams(vbNullString, rs, Password)
   If res <> 0 Then
      MsgBox "RAS error #" & res
   Else
      lstDetails.AddItem "Phone: " & rs.szPhoneNumber
      lstDetails.AddItem "User: " & rs.szUserName
      lstDetails.AddItem "Domain: " & rs.szDomain
   End If
End Sub

 
< previous page page_84 next page >